/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package requeteur;

import java.util.ArrayList;

/**
 *
 * @author Nargisse
 */
public class TermeReq {
    private String terme;
    private String position;
    private TermOccurReqCollection listTermeOccurReq;
    private ArrayList<Paragraphe> listParagraphe;
    
    public TermeReq(String terme, String position){
        this.terme = terme;
        this.position = position;
        this.listTermeOccurReq = new TermOccurReqCollection();
        
        this.listParagraphe = new ArrayList<Paragraphe>();
    }
    
    public void parsagePosition(){
        String[] t;
        t = this.position.split(";");
       // System.out.println("-1- terme => "+t[0]);
        for(int i=0; i<t.length; i++){
            String[] tt;
            tt = t[i].split(",");
            //System.out.println("-2- terme => "+tt[0]+" - "+tt[1]+" - "+tt[2]);
            this.listTermeOccurReq.addTermOccurReq(new TermOccurReq(Integer.parseInt(tt[0]),Integer.parseInt(tt[1]),this.terme,Double.parseDouble(tt[2])));  
            this.listParagraphe.add(new Paragraphe(Integer.parseInt(tt[0]), Double.parseDouble(tt[2]))); 
        }  
        //System.out.println(" -2- SIZE LIST PARA "+ this.listParagraphe.size());
    }
    
    public ArrayList<TermOccurReq> getListTermOccuReq(){
        return this.listTermeOccurReq.getListTermOccurReq();
    }
    
    public ArrayList<Paragraphe> getListPara(){
        return this.listParagraphe;
    }
    
    public String getNameTerme(){
        return this.terme;
    }
   
    
}
